package ye.guo.huang.easypoidemooo1.easypoidemooo1.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import ye.guo.huang.easypoidemooo1.easypoidemooo1.untils.ViliGroupOne;
import ye.guo.huang.easypoidemooo1.easypoidemooo1.untils.ViliGroupTwo;

import javax.validation.constraints.*;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class ValidatorEntity {
    /**
     * Email校验
     */
    @Excel(name = "Email", width = 25)
    @Email( message = "格式不匹配" ,groups = {ViliGroupOne.class})
    private String email;
    /**
     * 最大
     */
    @Excel(name = "Max")
    @Max(value = 15,message = "最大值不能超过15" ,groups = {ViliGroupOne.class})
    private int    max;
    /**
     * 最小
     */
    @Excel(name = "Min")
    @Min(value = 3, groups = {ViliGroupTwo.class},message ="最小值不能小于3" )
    private int    min;
    /**
     * 非空校验
     */
    @Excel(name = "NotNull")
    @NotNull(message ="不能为空",groups = {ViliGroupOne.class})
    private String notNull;
    /**
     * 正则校验
     */
    @Excel(name = "Regex")
    @Pattern(regexp = "[\u4E00-\u9FA5]*", message = "不是中文",groups = {ViliGroupOne.class})
    private String regex;
}
